home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / trubasic / rolldemos / chooser / scimenu.tru < prev    next >
Text File  |  1994-08-02  |  2KB  |  68 lines

  1. external
  2. ! main menu loop for scientific graphics demos
  3. module sci
  4. DECLARE PUBLIC scipts(,),scitxt$()
  5. sub sci_demos
  6.  
  7.     call draw_sci
  8.     call waitup
  9.     do
  10.         call getclick_sci(op)
  11.     if op=1 then 
  12.         chain "!cd ../demos/sci;../../basic/tru -i aboutsci.tru &",return
  13.     elseif op=2 then
  14.         chain "!cd ../demos/sci;../../basic/tru -i lsquare.tru &",return
  15.     elseif op=3 then
  16.         chain "!cd ../demos/sci;../../basic/tru -i meanfit.tru &",return
  17.     elseif op=4 then
  18.         chain "!cd ../demos/sci;../../basic/tru -i spline.tru &",return
  19.     elseif op=5 then
  20.         chain "!cd ../demos/sci;../../basic/tru -i vfunc.tru &",return
  21.     elseif op=0 then
  22.         exit sub
  23.     end if
  24.     if op<>0 and op<>-1 then
  25.                 call expand(scipts(op,1),scipts(op,2),scipts(op,3),scipts(op,4))
  26.    draw textbox(scipts(op,1),scipts(op,2),scipts(op,3),scipts(op,4),scitxt$(op))
  27.                 call waitup
  28.         pause 3
  29.               call unexpand(scipts(op,1),scipts(op,2),scipts(op,3),scipts(op,4))
  30.    draw textbox(scipts(op,1),scipts(op,2),scipts(op,3),scipts(op,4),scitxt$(op))
  31.     end if
  32.  
  33.     if refresh(1)=1 then 
  34.         call draw_sci
  35.     end if
  36.     loop
  37. end sub
  38.  
  39. sub draw_sci
  40.         let u=ubound(scipts,1)
  41.         clear
  42.         for i=1 to u
  43.                 draw scibox(i)
  44.         next i
  45.         box keep 0,1,0,1 in scibox$
  46. end sub
  47.  
  48. picture scibox(op)
  49.     draw box(scipts(op,1),scipts(op,2),scipts(op,3),scipts(op,4),op)
  50.    draw textbox(scipts(op,1),scipts(op,2),scipts(op,3),scipts(op,4),scitxt$(op))
  51. end picture
  52.  
  53. sub getclick_sci(op)
  54.         get mouse x,y,state
  55.         let op=-1
  56.         if state<>0 and x>=0 and x<=1 and y>=0 and y<=1 then
  57.            let u=ubound(scipts,1)
  58.        let op=0
  59.            for i=1 to u
  60.                 if x>scipts(i,1) and x<scipts(i,2) and y>scipts(i,3) and y<scipts(i,4) then
  61.                         let op=i
  62.                         exit sub
  63.                 end if
  64.            next i
  65.         end if
  66. end sub
  67. end module
  68.